Create the clone of a TupleΒΆ
T_clone = deepcopy(T)
Create the clone of a Tuple.
from copy import deepcopy
# create a tuple
T = ("HELLO", 5, [], True)
print(T) # ('HELLO', 5, [], True)
# make a copy of a tuple using deepcopy() function
T_clone = deepcopy(T)
T_clone[2].append(50) # append to the list is OK
print(T_clone) # ('HELLO', 5, [50], True)
print(T) # ('HELLO', 5, [], True)